import unittest
from HTMLTestRunner import HTMLTestRunner
import time
import os

# loader
loader = unittest.defaultTestLoader.discover('./', 'test_*')
# suite
# runner
report = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/report'
file_name = time.strftime('%Y-%m-%d %H-%M-%S') + '-demo.html'
file_path = os.path.join(report, file_name)

with open(file_path, 'wb') as f:
    runner = HTMLTestRunner(
        title='ECShop商城web自动化测试报告',
        # description='用户登录失败/成功,用户注册失败/成功,管理员登录失败/成功, 订单未支付/已支付, 添加新商品成功',
        tester='汪贤林 尹开力 桂伊凡 罗乐 李轩宇 阮继鹏',
        stream=f,
        verbosity=2
    )
    runner.run(loader)
